<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../core/include.inc.jsp"%>

<form onsubmit="return navTabSearch(this);" action="send_ann" method="post">
    <div class="pageContent">
        <table class="table" width="100%" layoutH="137">
            <thead>
            <tr>
                <th class="" style="width: 18px; cursor: default;"><div class="gridCol" title=""><input type="checkbox" group="ids" class="checkboxCtrl"></div></th>
                <th>序号</th>
                <th>小区名称</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="item" items="${list}" varStatus="st">
                <tr target="item_id" rel="${item.id}" ondblclick="tableclick()">
                    <td style="width: 18px;"><input name="ids" value="xxx" type="checkbox"></td>
                    <td>${st.index+1}</td>
                    <td style="display: none;">${item.id}</td>
                    <td>${item.blockName}</td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
        <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent" style="text-align: center;">
                            <button id="sure">发送</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <c:import url="../core/pagebar.inc.jsp" />
    </div>
</form>

<script>
    $("#sure").click(function () {
        var arr= document.getElementsByName("ids");
        var blockId=new Array();
        for(var i =0;i<arr.length;i++){
            if(arr[i].checked){
                //alert(arr[i].parentNode.parentNode.parentNode.children[2].textContent);
                blockId.push(arr[i].parentNode.parentNode.parentNode.children[2].textContent);
            }
        }
        console.log(blockId.toString())
        if( blockId == "" ){
            return false;
        }
        $.ajax({
            type:"POST",
            url:"send_ann",
            data:{
                "blockId":blockId.toString(),
                "annId":${annId}
            },
            dataType:"json",
            success:function(data){
                alert("发送成功")
            }
        })
        return false;
    })
</script>